



class Queue:
    def __init__(self, MAXlenth):
        self.items = []
        self.MAXlenth = MAXlenth # 队列的总长度

    # 判断队列是否为空
    def isEmpty(self):
        return not(len(self.items) != 0) # False是不空，True是空

    # 入队列
    def enQueue(self, item):
        if(self.isMAX()):
            return
            # print('队列已满')
        else:
            self.items.append(item)

    # 出队列
    def deQueue(self):
        self.items.pop(0)

    # 队列长度
    def size(self):
        return len(self.items)

    # 判断队列是否已满
    def isMAX(self):
        return self.size() >= self.MAXlenth    #false是没满，true是满了

    # 输出队列
    def printQueue(self):
        print(self.items)

    # 获得队头元素
    def get_hand(self):
        return self.items[0]

    # 获取队列剩余空间
    def get_remain(self):
        return self.MAXlenth - self.size()

    # 清空队列
    def clean(self):
        while self.size() > 0:
            self.deQueue()




if __name__ == '__main__':
    queue = Queue(4)
    print(queue.MAXlenth)
    queue.enQueue(5)
    queue.enQueue(0)
    queue.enQueue(3)
    # queue.enQueue(7)
    # queue.enQueue(9)
    print(not queue.isMAX())
    queue.printQueue()
    print(queue.size())
    queue.clean()
    queue.printQueue()


